﻿using System;
using System.Runtime.InteropServices;

namespace Mapenect
{
    public class CLNUIDevice
    {
        //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        // NUIDevice  API
        //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        [DllImport("libs\\CLNUIDevice.dll", EntryPoint = "GetNUIDeviceCount", CallingConvention = CallingConvention.Cdecl)]
        public static extern int GetDeviceCount();
        [DllImport("libs\\CLNUIDevice.dll", EntryPoint = "GetNUIDeviceSerial", CallingConvention = CallingConvention.Cdecl)]
        public static extern string GetDeviceSerial(int index);

        //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        // CLNUIMotor  API
        //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        [DllImport("libs\\CLNUIDevice.dll", EntryPoint = "CreateNUIMotor", CallingConvention = CallingConvention.Cdecl)]
        public static extern IntPtr CreateMotor(string serial);
        [DllImport("libs\\CLNUIDevice.dll", EntryPoint = "DestroyNUIMotor", CallingConvention = CallingConvention.Cdecl)]
        public static extern bool DestroyMotor(IntPtr motor);
        [DllImport("libs\\CLNUIDevice.dll", EntryPoint = "GetNUIMotorSerial", CallingConvention = CallingConvention.Cdecl)]
        public static extern string GetMotorSerial(IntPtr motor);
        [DllImport("libs\\CLNUIDevice.dll", EntryPoint = "SetNUIMotorPosition", CallingConvention = CallingConvention.Cdecl)]
        public static extern bool SetMotorPosition(IntPtr motor, short position);
        [DllImport("libs\\CLNUIDevice.dll", EntryPoint = "GetNUIMotorAccelerometer", CallingConvention = CallingConvention.Cdecl)]
        public static extern bool GetMotorAccelerometer(IntPtr motor, ref short x, ref short y, ref short z);
        [DllImport("libs\\CLNUIDevice.dll", EntryPoint = "SetNUIMotorLED", CallingConvention = CallingConvention.Cdecl)]
        public static extern bool SetMotorLED(IntPtr motor, byte mode);
        //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    }
}
